package com.stat;

import com.ability.AbilityEnum;
import com.charactersheet.sheet.CharacterSheet;
import com.info.BonusInfo;
import com.info.BonusTypeEnum;

public class CharacterSave {

	private int reflex;
	private int fortitude;
	private int will;
	
	private CharacterSheet sheet;

	public CharacterSave(CharacterSheet sheet){
		this.sheet = sheet;
	}
	
	public int getReflex() {
		return reflex;
	}

	public int getFortitude() {
		return fortitude;
	}

	public int getWill() {
		return will;
	}
	
	public void updateSheet(){
		updateReflex();
		updateFort();
		updateWill();
	}
	
	private void updateReflex(){
		reflex = sheet.getAbility().getAbilityModifiers()[AbilityEnum.DEXTERITY.ordinal()];
		BonusInfo bonus = new BonusInfo();
		bonus.addBonus(sheet.getClasses().getTotalBonus(BonusTypeEnum.REFLEX_BONUS, null));
		reflex += bonus.getBonusTotal();
	}
	
	private void updateFort(){
		fortitude = sheet.getAbility().getAbilityModifiers()[AbilityEnum.CONSTITUTION.ordinal()];
		BonusInfo bonus = new BonusInfo();
		bonus.addBonus(sheet.getClasses().getTotalBonus(BonusTypeEnum.FORTITUE_BONUS, null));
		fortitude += bonus.getBonusTotal();
	}
	
	private void updateWill(){
		will = sheet.getAbility().getAbilityModifiers()[AbilityEnum.WISDOM.ordinal()];
		BonusInfo bonus = new BonusInfo();
		bonus.addBonus(sheet.getClasses().getTotalBonus(BonusTypeEnum.WILL_BONUS, null));
		will += bonus.getBonusTotal();
	}
}
